//
//  PPMediator+PPPay.m
//  PPMediator_Example
//
//  Created by ppss on 2021/6/22.
//  Copyright © 2021 ppss. All rights reserved.
//

#import "PPMediator+PPPay.h"

@implementation PPMediator (PPPay)

- (void)PPMediator_PayWithType:(PPPayType)type Params:(NSDictionary *)params Success:(void(^)(NSDictionary *info))success Failure:(void(^)(NSDictionary *info))failure{
    
    NSMutableDictionary *paramsToSend = [[NSMutableDictionary alloc] init];
  
    if (success) {
        paramsToSend[@"success"] = success;
    }
    if (failure) {
        paramsToSend[@"failure"] = failure;
    }
    paramsToSend[@"order"] = params[@"order"];
    
    paramsToSend[@"order"] = params[@"appScheme"];
    
    paramsToSend[@"universalLink"] = params [@"universalLink"];
    
    paramsToSend[@"type"] = [NSString stringWithFormat:@"%lu",(unsigned long)type];
    
    [self performTarget:@"PPPayManager"
                 action:@"payWithParams"
                 params:paramsToSend
      shouldCacheTarget:NO];
}
@end
